home *** CD-ROM | disk | FTP | other *** search
- ;-------------------------sfp2dfp routine begins--------------------------+
- ; ROUTINE FOR CONVERSION FROM SINGLE PRECISION TO DOUBLE PRECISION
- ;
- ; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
- ; page : 111
- ;
- ; NAME SFP2DFP
- ;
- ; FUNCTION: This routine converts from single precision binary floating point
- ; to internal double precision floating point.
- ;
- ; INPUT: Upon entry a number is stored in single precision binary floating
- ; point form in SFPBUFF. The single precision binary floating point number
- ; has a 24-bit binary mantissa, a sign bit, and an 8-bit exponent biased by
- ; 128 (See fig 5-3).
- ;
- ; OUTPUT: Upon exit a internal double precision binary floating point
- ; number is stored in DFPBUFF. The internal double precision floating point
- ; number has a 40-bit binary mantissa, a sign bit,and an 8-bit exponent
- ; biased by 128 (See fig 5-8).
- ;
- ; REGISTERS USED: No registers are modified.
- ;
- ; SEGMENTS REFERENCED: Upon entry the data segment must contain the
- ; storage for the variables SFPBUFF and DFPBUFF.
- ;
- ; ROUTINES CALLED: None
- ;
- ; SPECIAL NOTES: Equates are used to shorten address fields.
- ;
- ; ROUTINE TO CONVERT FROM INTERNAL SINGLE PRECISION FLOATING POINT TO
- ; INTERNAL DOUBLE PRECISION FLOATING POINT
- ;
- sfp2dfp proc far
- ;
- push ax ; save registers
- ;
- ; clear lower part of mantissa
- mov dfpbuffw0,0 ; clear low word
- mov dfpbuffw2,0 ; clear next low word
- ;
- ; move rest of mantissa
- mov ax,sfpbuffw0 ; get word from single precision
- mov dfpbuffw4,ax ; put in double precision
- ;
- mov ax,sfpbuffw2 ; get word from single precision (7 hi bits)
- mov dfpbuffw6,ax ; put in double precision
- ;
- pop ax ; restore registers
- ret ; return
- ;
- sfp2dfp endp
- ;-------------------------sfp2dfp routine ends---------------------------+
-